package com.verisette.ncos.web.master.action;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import org.corp.agi.basic.service.accessmanagement.gateway.UserManagementService;
import org.corp.agi.common.annotation.RequiresAuthentication;
import org.corp.agi.common.bean.LabelValueBean;
import org.corp.agi.common.bean.PagingBean;
import org.corp.agi.common.constant.CommonConstant;
import org.corp.agi.service.bean.ServiceRequest;
import org.corp.agi.service.bean.ServiceResponse;
import org.corp.agi.web.action.BaseAction;
import org.corp.agi.web.util.ServiceRequestFactory;
import com.verisette.ncos.common.CommonUtil;
import com.verisette.ncos.common.PrivConst;
import com.verisette.ncos.common.ProjectConstant;
import com.verisette.ncos.persistence.domain.CustomMasterUserProfile;
import com.verisette.ncos.persistence.domain.LogUserAccess;
import com.verisette.ncos.persistence.domain.MasterUserProfile;
import com.verisette.ncos.service.datasupport.gateway.NcosSupportService;
import com.verisette.ncos.service.master.gateway.UserProfileManagementService;

@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class UserProfileManagementAction extends BaseAction {
	private Logger logger = Logger.getLogger(UserProfileManagementAction.class); 
	
	private MasterUserProfile userProfileBean;
	private MasterUserProfile searchUserProfileBean;
	
	private String confirmPassword;
	private String newPassword;
	private String oldPassword;
	private String[] assignedRoles;
	private String selectedId; // For Add UserProfile
	private String editMode;
	private String clickSearchFlag;
	private Timestamp uspExpireDate;
	private Timestamp uspLastAccessDate;
	
	private List<LabelValueBean> assignedRolesList;
	private List<LabelValueBean> statusList;
	private List<LabelValueBean> roleList;
	private List<CustomMasterUserProfile> resultList;
	private List<LogUserAccess> logResultList;
	
	// Paging for Search UserProfile
	private PagingBean pagingBean;
	
	// Paging for View Access Log
	private PagingBean logPagingBean;
	
	// For Sort data
	private String sortMode;
	private String sortBy;
	
	private NcosSupportService ncosSupportService;
	@Autowired
	@Required
	public void setNcosSupportService(
			@Qualifier("supportService")NcosSupportService ncosSupportService) {
		this.ncosSupportService = ncosSupportService;
	}

	private UserProfileManagementService userProfileManagementService;
	@Autowired
	@Required
	public void setUserProfileManagementService(
			@Qualifier("userProfileManagementServiceImpl")UserProfileManagementService userProfileManagementService) {
		this.userProfileManagementService = userProfileManagementService;
	}
	
	@RequiresAuthentication(granted={PrivConst.S010100})
	public String init(){
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": init" );
		
		pagingBean = new PagingBean(ProjectConstant.ROW_PER_PAGE);
		
		logPagingBean = new PagingBean(ProjectConstant.ROW_PER_PAGE);
		
		initList();
		
		return "searchUserProfile";
	}
	
	@RequiresAuthentication(granted={PrivConst.S010101})
	public String search() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": searchUserProfile" );

		initList();

		if(clickSearchFlag.equals("true")){

			//---------->Add and Edit by Sudarat Trairatanobhas(Ming) 11/04/2010
			if(logger.isDebugEnabled()){
				logger.debug("sortMode-->"+this.sortMode);
				logger.debug("sortBy-->"+this.sortBy);
			}

			//****check sort by
			if(StringUtils.isEmpty(this.sortBy)){
				this.sortBy = "uspId";
			}
			//****check sort mode
			if(StringUtils.isEmpty(this.sortMode)){
				this.sortMode = PagingBean.ORDER_ASC;
			}
			
			if(logger.isDebugEnabled()){
				logger.debug("sortMode-->"+this.sortMode);
				logger.debug("sortBy-->"+this.sortBy);
			}

			pagingBean.setOrderMode(this.sortMode);
			pagingBean.setOrderBy(this.sortBy);
			//End---------->Add and Edit by Sudarat Trairatanobhas(Ming) 11/04/2010

			ServiceRequest<MasterUserProfile> inquiryUserProfileReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
			inquiryUserProfileReq.setValueObject(searchUserProfileBean);

			inquiryUserProfileReq.setPaging(pagingBean);

			ServiceResponse<List<CustomMasterUserProfile>> inquiryUserProfileRes = userProfileManagementService.inquiryUserProfile(inquiryUserProfileReq);
			
			if(isServiceResponseSuccess(inquiryUserProfileRes)){
				resultList = inquiryUserProfileRes.getValueObject();
				
				// set uspStatus for show
				for(CustomMasterUserProfile c : resultList){
					if(ProjectConstant.USER_PROFILE_STATUS_ACTIVE.equals(c.getUspStatus())){
						c.setUspStatus("Active");
						
					}else if(ProjectConstant.USER_PROFILE_STATUS_INACTIVE.equals(c.getUspStatus())){
						c.setUspStatus("Inactive");
						
					}
					
				}
				
			}
			
		}

		return "searchUserProfile";
	} 
	
	@RequiresAuthentication(granted={PrivConst.S010200})
	public String preAdd() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": initAddEditUserProfile" );
		
		userProfileBean = new MasterUserProfile();
		userProfileBean.setUspStatus(ProjectConstant.USER_PROFILE_STATUS_ACTIVE);
		
		initList();
		
		return "addEditUserProfile";
		
	}

	@RequiresAuthentication(granted={PrivConst.S010201})
	public String add() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": addUserProfile" );
		
		assignedRoles = httpServletRequest.getParameterValues("assignedList");
		
		ServiceRequest<Map<String, Object>> createUserProfileReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		Map<String, Object> inputMap = new HashMap<String, Object>();
		
		inputMap.put(ProjectConstant.USER_PROFILE, userProfileBean);
		inputMap.put(ProjectConstant.USER_PROFILE_ASSIGNED_ROLE, assignedRoles);
		
		createUserProfileReq.setValueObject(inputMap);
		
		ServiceResponse createUserProfileRes = userProfileManagementService.createUserProfile(createUserProfileReq);
		
		if(isServiceResponseSuccess(createUserProfileRes)){
			
		}else{
			initList();
			
			return "addEditUserProfile";
			
		}
		
		return search();
	}
	
	@RequiresAuthentication(granted={PrivConst.S010200})
	public String view() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": view" );
		
		userProfileBean = new MasterUserProfile();
		userProfileBean.setUspId(Integer.parseInt(selectedId));
		
		ServiceRequest<MasterUserProfile> viewUserProfileReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		viewUserProfileReq.setValueObject(userProfileBean);
		
		ServiceResponse<List<CustomMasterUserProfile>> viewUserProfileRes = userProfileManagementService.viewUserProfile(viewUserProfileReq);
		
		if(isServiceResponseSuccess(viewUserProfileRes)){
			userProfileBean = setCustomToMasterUserProfile(viewUserProfileRes.getValueObject().get(0));
			
			// set UspLockFlag for show
			if(ProjectConstant.Y_FLAG.equals(userProfileBean.getUspLockFlag())){
				userProfileBean.setUspLockFlag("Yes");
				
			}else if(ProjectConstant.N_FLAG.equals(userProfileBean.getUspLockFlag())){
				userProfileBean.setUspLockFlag("No");
				
			}
			// set UspForceChngPwdFlag for show
			if(ProjectConstant.Y_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
				userProfileBean.setUspForceChngPwdFlag("Yes");
				
			}else if(ProjectConstant.N_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
				userProfileBean.setUspForceChngPwdFlag("No");
				
			}

			// calculate password expired for show
			if(null!=userProfileBean.getUspExpireDate()){
				Calendar cal = Calendar.getInstance();
				Timestamp nowTimestamp = new Timestamp(cal.getTimeInMillis());
				Timestamp expireTimestamp = userProfileBean.getUspExpireDate();
				if( (expireTimestamp.before(nowTimestamp))||(expireTimestamp.equals(nowTimestamp)) ){
					userProfileBean.setPasswordExpired(ProjectConstant.YES_FLAG);
				}else{
					userProfileBean.setPasswordExpired(ProjectConstant.NO_FLAG);
				}
			}
			

			
			initList();
			setCustomToAssignedRoles(viewUserProfileRes.getValueObject());

		}else{
			return "searchUserProfile";
			
		}
		
		return "viewUserProfile";
	}
	
	@RequiresAuthentication(granted={PrivConst.S010200})
	public String preEdit() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": preEdit" );
		
		userProfileBean = new MasterUserProfile();
		userProfileBean.setUspId(Integer.parseInt(selectedId));
		
		ServiceRequest<MasterUserProfile> viewUserProfileReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		viewUserProfileReq.setValueObject(userProfileBean);
		
		ServiceResponse<List<CustomMasterUserProfile>> viewUserProfileRes = userProfileManagementService.viewUserProfile(viewUserProfileReq);
		
		if(isServiceResponseSuccess(viewUserProfileRes)){
			userProfileBean = setCustomToMasterUserProfile(viewUserProfileRes.getValueObject().get(0));
			
			// set UspLockFlag for show
			if(ProjectConstant.Y_FLAG.equals(userProfileBean.getUspLockFlag())){
				userProfileBean.setUspLockFlag(ProjectConstant.YES_FLAG);
				
			}else if(ProjectConstant.N_FLAG.equals(userProfileBean.getUspLockFlag())){
				userProfileBean.setUspLockFlag(ProjectConstant.NO_FLAG);
				
			}
			// set UspForceChngPwdFlag for show
			if(ProjectConstant.Y_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
				userProfileBean.setUspForceChngPwdFlag(ProjectConstant.YES_FLAG);
				
			}else if(ProjectConstant.N_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
				userProfileBean.setUspForceChngPwdFlag(ProjectConstant.NO_FLAG);
				
			}
			
			//keep value for edit
			uspExpireDate = userProfileBean.getUspExpireDate();
			uspLastAccessDate = userProfileBean.getUspLastAccessDate();
			
			// calculate password expired for show
			if(null!=userProfileBean.getUspExpireDate()){
				Calendar cal = Calendar.getInstance();
				Timestamp nowTimestamp = new Timestamp(cal.getTimeInMillis());
				Timestamp expireTimestamp = userProfileBean.getUspExpireDate();
				if( (expireTimestamp.before(nowTimestamp))||(expireTimestamp.equals(nowTimestamp)) ){
					userProfileBean.setPasswordExpired(ProjectConstant.YES_FLAG);
				}else{
					userProfileBean.setPasswordExpired(ProjectConstant.NO_FLAG);
				}
			}
			
			initList();
			setCustomToAssignedRoles(viewUserProfileRes.getValueObject());
			editMode = "true";
			
		}else{
			return "searchUserProfile";
			
		}
		
		return "addEditUserProfile";
	}
	
	@RequiresAuthentication(granted={PrivConst.S010201})
	public String edit() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": edit" );
		
		assignedRoles = httpServletRequest.getParameterValues("assignedList");
		
		ServiceRequest<Map<String, Object>> editUserProfileReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		Map<String, Object> inputMap = new HashMap<String, Object>();
		
		// set uspExpireDate for update
		userProfileBean.setUspExpireDate( uspExpireDate );
		
		// set uspLastAccessDate for update
		userProfileBean.setUspLastAccessDate( uspLastAccessDate );
		
		// set UspForceChngPwdFlag for show
		if(ProjectConstant.YES_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
			userProfileBean.setUspForceChngPwdFlag(ProjectConstant.Y_FLAG);
			
		}else if(ProjectConstant.NO_FLAG.equals(userProfileBean.getUspForceChngPwdFlag())){
			userProfileBean.setUspForceChngPwdFlag(ProjectConstant.N_FLAG);
			
		}
		
		//change lock flag before update to MASTER_USER_PROFILE.
		if(ProjectConstant.YES_FLAG.equals(userProfileBean.getUspLockFlag())){
			userProfileBean.setUspLockFlag(ProjectConstant.Y_FLAG);
		}else if(ProjectConstant.NO_FLAG.equals(userProfileBean.getUspLockFlag())){
			userProfileBean.setUspLockFlag(ProjectConstant.N_FLAG);
		}
		
		inputMap.put(ProjectConstant.USER_PROFILE, userProfileBean);
		inputMap.put(ProjectConstant.USER_PROFILE_ASSIGNED_ROLE, assignedRoles);
		inputMap.put(ProjectConstant.USER_PROFILE_OLD_PASSWORD, oldPassword);
		inputMap.put(ProjectConstant.USER_PROFILE_NEW_PASSWORD, newPassword);
		
		editUserProfileReq.setValueObject(inputMap);
		
		ServiceResponse editUserProfileRes = userProfileManagementService.editUserProfile(editUserProfileReq);
		
		if(isServiceResponseSuccess(editUserProfileRes)){
			
		}else{
			initList();
			removeRoleList(assignedRolesList);
			
			return "addEditUserProfile";
			
		}
		
		return search();
		
	}
	
	@RequiresAuthentication(granted={PrivConst.S010300})
	public String viewAccessLog() throws Exception{
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": viewAccessLog" );
		
		ServiceRequest<MasterUserProfile> viewAccessLogReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		viewAccessLogReq.setValueObject(userProfileBean);
		
		if(sortMode != null && !"".equals(sortMode))
			logPagingBean.setOrderMode(sortMode);
		else
			sortMode = PagingBean.ORDER_ASC;
		
		logPagingBean.setOrderBy("uacDatetime");
		viewAccessLogReq.setPaging(logPagingBean);
		
		ServiceResponse<List<LogUserAccess>> viewAccessLogRes = userProfileManagementService.viewAccessLogUserProfile(viewAccessLogReq);
		
		if(isServiceResponseSuccess(viewAccessLogRes)){
			logResultList = viewAccessLogRes.getValueObject();
			selectedId = userProfileBean.getUspId() + "";
			
		}else{
			
			return "";
			
		}
		
		return "viewAccessLogUserProfile";
	}
	
	public void initList(){
		statusList = new ArrayList<LabelValueBean>();
		statusList.add(new LabelValueBean("Active", "A"));
		statusList.add(new LabelValueBean("Inactive", "I"));
		
		roleList = ncosSupportService.getAllRoles();
		
	}
	
	public MasterUserProfile setCustomToMasterUserProfile(CustomMasterUserProfile customUserProfile){
		MasterUserProfile masterUserProfile = new MasterUserProfile();
		
		masterUserProfile.setUspId(customUserProfile.getUspId());
		masterUserProfile.setUspUserName(customUserProfile.getUspUserName());
		masterUserProfile.setUspTitle(customUserProfile.getTitle());
		masterUserProfile.setUspFname(customUserProfile.getUspFname());
		masterUserProfile.setUspMname(customUserProfile.getUspMname());
		masterUserProfile.setUspLname(customUserProfile.getUspLname());
		masterUserProfile.setUspPassword(customUserProfile.getUspPassword());
		masterUserProfile.setUspStatus(customUserProfile.getUspStatus());
		
		masterUserProfile.setUspTelNo(customUserProfile.getUspTelNo());
		masterUserProfile.setUspMobileNo(customUserProfile.getUspMobileNo());
		masterUserProfile.setUspEmail(customUserProfile.getUspEmail());
		masterUserProfile.setUspExpireDate(customUserProfile.getUspExpireDate());
		masterUserProfile.setUspLastAccessDate(customUserProfile.getUspLastAccessDate());
		masterUserProfile.setUspWrongLoginCounter(customUserProfile.getUspWrongLoginCounter());
		masterUserProfile.setUspLockFlag(customUserProfile.getUspLockFlag());
		masterUserProfile.setUspForceChngPwdFlag(customUserProfile.getUspForceChngPwdFlag());
		
		return masterUserProfile;
	}
	
	public void setCustomToAssignedRoles(List<CustomMasterUserProfile> customUserProfileList){
		
		assignedRolesList = new ArrayList<LabelValueBean>();
		for(int i = 0; i < customUserProfileList.size(); i++){
			assignedRolesList.add(new LabelValueBean(customUserProfileList.get(i).getUsgName(), customUserProfileList.get(i).getUsgId()+""));
			
		}
		
		// Remove role in roleListBox
		roleList = ncosSupportService.getAllRoles();
		for(int i = 0; i < assignedRolesList.size(); i++){
			for(LabelValueBean r : roleList){
				if(r.getLabel().equals(assignedRolesList.get(i).getLabel())){
					roleList.remove(r);
					break;
					
				}
				
			}
			
		}
		
	}
	
	public void removeRoleList(List<LabelValueBean> assignedRolesList){
		// Remove role in roleListBox
		for(int i = 0; i < assignedRolesList.size(); i++){
			for(LabelValueBean r : roleList){
				if(r.getLabel().equals(assignedRolesList.get(i).getLabel())){
					roleList.remove(r);
					break;
					
				}
				
			}
			
		}
		
	}
	
	@RequiresAuthentication(granted={PrivConst.S010201})
	public String resetPassword()throws Exception{
		
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": resetPassword" );
		
		Map<String, Object> inputMap = new HashMap<String, Object>();
		inputMap.put(ProjectConstant.USER_PROFILE, userProfileBean);
		
		ServiceRequest<Map<String, Object>> resetUserPasswordReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		resetUserPasswordReq.setValueObject(inputMap);
		
		ServiceResponse resetUserPasswordRes = userProfileManagementService.resetUserPassword(resetUserPasswordReq);
		
		if(isServiceResponseSuccess(resetUserPasswordRes)){
			
		}else{
			initList();
			return "addEditUserProfile";
			
		}
		
		return search();
	}
	
	@RequiresAuthentication(granted={PrivConst.S010201})
	public String userLock()throws Exception{
		
		if(logger.isInfoEnabled()) logger.info( this.getClass().getSimpleName() + ": userLock" );
		
		if(ProjectConstant.Y_FLAG.equals(userProfileBean.getUspLockFlag())){
			userProfileBean.setUspLockFlag(ProjectConstant.Y_FLAG);
		}else if(ProjectConstant.N_FLAG.equals(userProfileBean.getUspLockFlag())){
			userProfileBean.setUspLockFlag(ProjectConstant.N_FLAG);
		}
		
		
		Map<String, Object> inputMap = new HashMap<String, Object>();
		inputMap.put(ProjectConstant.USER_PROFILE, userProfileBean);
		
		ServiceRequest<Map<String, Object>> userLockReq = ServiceRequestFactory.getNewServiceRequest(httpServletRequest);
		userLockReq.setValueObject(inputMap);
		
		ServiceResponse userLockRes = userProfileManagementService.changeUserLockFlag(userLockReq);
		
		if(isServiceResponseSuccess(userLockRes)){
			
		}else{
			initList();
			return "addEditUserProfile";
			
		}
		
		return search();
	}
	
	
	
	public MasterUserProfile getUserProfileBean() {
		return userProfileBean;
	}

	public void setUserProfileBean(MasterUserProfile userProfileBean) {
		this.userProfileBean = userProfileBean;
	}

	public List<LabelValueBean> getStatusList() {
		return statusList;
	}

	public void setStatusList(List<LabelValueBean> statusList) {
		this.statusList = statusList;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

	public List<LabelValueBean> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<LabelValueBean> roleList) {
		this.roleList = roleList;
	}

	public String[] getAssignedRoles() {
		return assignedRoles;
	}

	public void setAssignedRoles(String[] assignedRoles) {
		this.assignedRoles = assignedRoles;
	}

	public MasterUserProfile getsearchUserProfileBean() {
		return searchUserProfileBean;
	}

	public void setsearchUserProfileBean(MasterUserProfile searchUserProfileBean) {
		this.searchUserProfileBean = searchUserProfileBean;
	}

	public PagingBean getPagingBean() {
		return pagingBean;
	}

	public void setPagingBean(PagingBean pagingBean) {
		this.pagingBean = pagingBean;
	}

//	public int getRequestPage() {
//		return requestPage;
//	}
//
//	public void setRequestPage(int requestPage) {
//		this.requestPage = requestPage;
//	}
//
//	public int getRowsPerPage() {
//		return rowsPerPage;
//	}
//
//	public void setRowsPerPage(int rowsPerPage) {
//		this.rowsPerPage = rowsPerPage;
//	}

	public List<CustomMasterUserProfile> getResultList() {
		return resultList;
	}

	public void setResultList(List<CustomMasterUserProfile> resultList) {
		this.resultList = resultList;
	}

	public String getSelectedId() {
		return selectedId;
	}

	public void setSelectedId(String selectedId) {
		this.selectedId = selectedId;
	}

	public String getEditMode() {
		return editMode;
	}

	public void setEditMode(String editMode) {
		this.editMode = editMode;
	}

	public String getOldPassword() {
		return oldPassword;
	}

	public void setOldPassword(String oldPassword) {
		this.oldPassword = oldPassword;
	}

	public List<LabelValueBean> getAssignedRolesList() {
		return assignedRolesList;
	}

	public void setAssignedRolesList(List<LabelValueBean> assignedRolesList) {
		this.assignedRolesList = assignedRolesList;
	}

	public String getClickSearchFlag() {
		return clickSearchFlag;
	}

	public void setClickSearchFlag(String clickSearchFlag) {
		this.clickSearchFlag = clickSearchFlag;
	}

	public PagingBean getLogPagingBean() {
		return logPagingBean;
	}

	public void setLogPagingBean(PagingBean logPagingBean) {
		this.logPagingBean = logPagingBean;
	}

//	public int getLogRequestPage() {
//		return logRequestPage;
//	}
//
//	public void setLogRequestPage(int logRequestPage) {
//		this.logRequestPage = logRequestPage;
//	}
//
//	public int getLogRowsPerPage() {
//		return logRowsPerPage;
//	}
//
//	public void setLogRowsPerPage(int logRowsPerPage) {
//		this.logRowsPerPage = logRowsPerPage;
//	}

	public List<LogUserAccess> getLogResultList() {
		return logResultList;
	}

	public void setLogResultList(List<LogUserAccess> logResultList) {
		this.logResultList = logResultList;
	}

	public String getSortMode() {
		return sortMode;
	}

	public void setSortMode(String sortMode) {
		this.sortMode = sortMode;
	}

	public String getNewPassword() {
		return newPassword;
	}

	public void setNewPassword(String newPassword) {
		this.newPassword = newPassword;
	}

	public MasterUserProfile getSearchUserProfileBean() {
		return searchUserProfileBean;
	}

	public void setSearchUserProfileBean(MasterUserProfile searchUserProfileBean) {
		this.searchUserProfileBean = searchUserProfileBean;
	}

	public Timestamp getUspExpireDate() {
		return uspExpireDate;
	}

	public void setUspExpireDate(Timestamp uspExpireDate) {
		this.uspExpireDate = uspExpireDate;
	}

	public Timestamp getUspLastAccessDate() {
		return uspLastAccessDate;
	}

	public void setUspLastAccessDate(Timestamp uspLastAccessDate) {
		this.uspLastAccessDate = uspLastAccessDate;
	}

	public String getSortBy() {
		return sortBy;
	}

	public void setSortBy(String sortBy) {
		this.sortBy = sortBy;
	}

}
